//Cylinder.cpp
//Contains the function definitions for the Cylinder Class

#include <iostream>
#include "Cylinder.h"

using namespace std;

Cylinder::Cylinder(const float &p_X, const float &p_Y, float rad, float hgt)
	: Circle(p_X, p_Y, rad)
{
	setHeight(hgt);
	setVol();
}

void Cylinder::setHeight(float hgt)
{
	if (hgt >= 0)
		height = hgt;
	else
		throw invalid_argument("The height must be greater than zero.");
}

float Cylinder::getHeight() const
{
	return height;
}

void Cylinder::setVol()
{
	C_volume = getHeight() * Circle::getArea();
}

float Cylinder::getCylVol() const
{
	return C_volume;
}

float Cylinder::volume() const
{
	return getCylVol();
}

float Cylinder::area() const
{
	return Circle::getArea();
}

float Cylinder::perimeter() const
{
	return Circle::getPerim();
}

